package com.paotui.controller;

import cn.hutool.json.JSONUtil;
import com.paotui.common.R;

import com.paotui.pojo.Users_address;
import com.paotui.service.impl.UsersAddressServiceImpl;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/users/address/modify")
public class UsersAddressModifyController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Users_address address = new Users_address();
        address.setAddressID(Integer.parseInt(request.getParameter("AddressID")));
        address.setLabel(request.getParameter("Label"));
        address.setAddressDetails(request.getParameter("AddressDetails"));
        UsersAddressServiceImpl impl = new UsersAddressServiceImpl();
        impl.updateById(address);
        impl.getSqlSession().close();
        response.getWriter().write(JSONUtil.toJsonStr(R.success("修改成功")));
    }
}
